Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add timezone and datetime formatting on workspace member level #5699

Open
wants to merge 48 commits into
base: main
Choose a base branch
from

Conversation

AdityaPimpalkar
Copy link
Contributor

closes: #5140

Copy link

github-actions bot commented May 31, 2024

TODOs/FIXMEs:

  • // TODO: use the user's saved time zone. If undefined, default it with the user's detected time zone.: packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarDisplaySettings.tsx
  • // TODO: use the user's saved date format.: packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarDisplaySettings.tsx
  • // TODO: use the user's saved time format.: packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarDisplaySettings.tsx

Generated by 🚫 dangerJS against 03f5799

@AdityaPimpalkar AdityaPimpalkar marked this pull request as ready for review June 2, 2024 23:14
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Added timezone and datetime formatting fields to WorkspaceMember type in GraphQL
  • Introduced DateTimeSettings component for user-specific datetime preferences
  • Refactored and moved timezone and datetime utilities to workspace-member module
  • Deleted redundant components and constants related to datetime settings
  • Updated mock data to include new timezone and datetime formatting properties

Copy link
Contributor

@martmull martmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, added some first comments, think we should use enums for workspace-member entity as you suggest, also we would like to create a graphql type to be able to use those enum values in the front

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Introduced timezone and datetime formatting at the workspace member level
  • Updated GraphQL queries and mutations to use new DateFormat and TimeFormat enums
  • Enhanced DateTimeSettings.tsx for granular control over date and time settings
  • Added new fields and enums for timeZone, dateFormat, and timeFormat in workspace-member.dto.ts
  • Updated workspace-member.workspace-entity.ts to define and use new enums for date and time formats

@@ -34,7 +34,7 @@ export const Elipsis: Story = {

export const Performance = getProfilingStory({
componentName: 'DateTimeFieldDisplay',
averageThresholdInMs: 0.1,
averageThresholdInMs: 0.2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: check - if we merge like this we need to be sure there isn't a better solution

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is okay to increase if we don't have the choice but in that case you have to "proof" that you've understood the reason why it was increasing and why we can't do any better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Memoizing the function outside of react scope did the job! Now its running under 0.1ms 👍

setTimeZone,
TimeFormat.STANDARD,
)})`,
value: TimeFormat.STANDARD,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come 12 hours is "standard" 😁. We use 24hours in France ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, I agree the naming is a little confusing here, its the "format" for time here which is "standard" if that makes sense. Whichever timezone is detected it will set it automatically to that "format" for that respective timezone

Copy link
Member

@FelixMalfait FelixMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Almost there :)

Comment on lines +60 to +72
const handleSettingsChange = (
settingName: 'timeZone' | 'dateFormat' | 'timeFormat',
value: string,
) => {
const workspaceMember: any = {};
const dateTime: any = {};

switch (settingName) {
case 'timeZone': {
workspaceMember[settingName] = value;
dateTime[settingName] = value === 'system' ? detectTimeZone() : value;
break;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried something different here to call setDateTimeFormat once, open for suggestions :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date and time formatting and timezone
4 participants